 
/*
 * @Description: 
 * @Author: maizi
 * @Date: 2023-04-03 17:36:41
 * @LastEditTime: 2023-04-03 21:02:36
 * @LastEditors: maizi
 */
import AmapMercatorTilingScheme from './AmapMercatorTilingScheme'
//影像（无标注）
const IMG_URL = 'https://webst0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x={x}&y={y}&z={z}'
//电子(无标注)
const VEC_URL = 'https://wprd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&ltype=3&x={x}&y={y}&z={z}'
//道路(无标注)
const ROAD_URL = 'https://webst0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&ltype=11&x={x}&y={y}&z={z}'
 //电子（有标注）
const VEC_LABEL_URL = 'https://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}'
//道路（有标注）
const ROAD_LABEL_URL = 'http://webst0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}'
 
export default class AmapImageryProvider extends Cesium.UrlTemplateImageryProvider {
  constructor(options = {}) {
    switch(options.type) {
      case 'img_w':
        options['url'] = IMG_URL
        break
      case 'vec_w':
        options['url'] = VEC_URL
        break
      case 'road_w':
        options['url'] = ROAD_URL
        break
      case 'vec_label_w':
        options['url'] = VEC_LABEL_URL
        break
      case 'road_label_w':
        options['url'] = ROAD_LABEL_URL
        break
    }
    if (!options.subdomains || !options.subdomains.length) {
      options['subdomains'] = ['1', '2', '3', '4']
    }
    if (options.crs === 'WGS84') {
      options['tilingScheme'] = new AmapMercatorTilingScheme()
    }
    super(options)
  }
}



/*

  const  tdtLayer = new Cesium.UrlTemplateImageryProvider({
                url: "http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",
                minimumLevel: 3,
                maximumLevel: 18,
                tilingScheme: new AmapMercatorTilingScheme(),//坐标矫正
            })
  viewer.imageryLayers.addImageryProvider(tdtLayer);


*/

